# calculator.py
def add(a, b): return a + b
def sub(a, b): return a - b
def mul(a, b): return a * b
def div(a, b): return a / b if b != 0 else "Error"

if __name__ == "__main__":
    print("选择操作：1.加 2.减 3.乘 4.除")
    choice = input("输入选择(1/2/3/4): ")
    a = float(input("第一个数字: "))
    b = float(input("第二个数字: "))
    
    if choice == '1': print(f"结果: {add(a,b)}")
    elif choice == '2': print(f"结果: {sub(a,b)}")
    elif choice == '3': print(f"结果: {mul(a,b)}")
    elif choice == '4': print(f"结果: {div(a,b)}")